package com.sbr.tbd.wicket.pages.administration.feature;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PropertyListView;
import org.apache.wicket.spring.injection.annot.SpringBean;

import com.sbr.tbd.dao.FeatureDao;
import com.sbr.tbd.model.Feature;
import com.sbr.tbd.wicket.pages.administration.AdministrationBasePage;
import com.sbr.tbd.wicket.panels.feature.EditFeaturePanel;


public class ListFeaturesPage extends AdministrationBasePage {

	@SpringBean
	private FeatureDao featureDao;
	
	
    public ListFeaturesPage() {
    	super();

    	add(new PropertyListView<Feature>("featuresList", featureDao.readAll()) {

			@Override
			protected void populateItem(ListItem<Feature> item) {
				Feature feature = item.getModelObject();
				item.add(new Label("name", feature.getName()));
			}
    		
    	});
    	add(new EditFeaturePanel("editFeaturePanel"));
    }


	public void setFeatureDao(FeatureDao featureDao) {
		this.featureDao = featureDao;
	}

}
